package me.ree.zkproduct.dto;

import lombok.Data;

@Data
public class PageQueryDTO<T> extends QueryDTO {

    private int pageNumber; // 页码，通常从1开始

    private int pageSize;

    private T t;

    public void check() {
        if (pageNumber <= 0) {
            pageNumber = 1;
        }
        if (pageNumber <= 0 || pageSize > 200) {
            pageSize = 10;
        }
    }

    public int getOffset(){
        return (pageNumber - 1) * pageSize;
    }
}
